<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>
<html>
<head>
	<title>计费明细管理</title>
	<meta name="decorator" content="ani"/>
	<script type="text/javascript">

		$(document).ready(function() {
			$("#inputForm").validate({
				submitHandler: function(form){
					jp.loading();
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
			
	        $('#busyDate').datetimepicker({
				 format: "YYYY-MM-DD HH:mm:ss"
		    });
	        $('#updateClearingDate').datetimepicker({
				 format: "YYYY-MM-DD HH:mm:ss"
		    });
            //当结算日期为空时，赋值当前时间
            if($("#dd").val()==""){
                document.getElementById("dd").value = getNowFormatDate();
            }
            //初始状态默认为已输入
            if($("#status").val()==""){
                $("#status").val(0);
            }
		});
        <%--给日期赋初始值--%>
        function getNowFormatDate() {
            var date = new Date();
            var seperator1 = "-";
            var seperator2 = ":";
            var month = date.getMonth() + 1;
            var strDate = date.getDate();
            if (month >= 1 && month <= 9) {
                month = "0" + month;
            }
            if (strDate >= 0 && strDate <= 9) {
                strDate = "0" + strDate;
            }
            var minute = date.getMinutes();
            if (minute >= 0 && minute <= 9) {
                minute = "0" + minute;
            }
            var seconds = date.getSeconds();
            if (seconds >= 0 && seconds <= 9) {
                seconds = "0" + seconds;
            }
            var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate
                + " " + date.getHours() + seperator2 + minute + seperator2 + seconds;
            return currentdate;
        }
	</script>
</head>
<body>
<div class="wrapper wrapper-content">				
<div class="row">
	<div class="col-md-12">
	<div class="panel panel-primary">
		<div class="panel-heading">
			<h3 class="panel-title"> 
				<a class="panelButton" href="${ctx}/fee/detail"><i class="ti-angle-left"></i> 返回</a>
			</h3>
		</div>
		<div class="panel-body">
		<form:form id="inputForm" modelAttribute="detail" action="${ctx}/fee/detail/save" method="post" class="form-horizontal">
		<form:hidden path="id"/>
		<sys:message content="${message}"/>
			<table class="table table-bordered  table-condensed dataTables-example dataTable no-footer">
				<tbody>
				<tr>
					<td class="width-15 active"><label class="pull-right"><font color="red">*&nbsp;</font>结算方：</label></td>
					<td class="width-35">
						<input type="text" value="${detail.clearUnit.name}" class="form-control"  readonly="readonly"/>
						<%--<sys:gridselect url="${ctx}/fee/consignor/data" id="clearUnit" name="clearUnit.id" value="${detail.clearUnit.id}" labelName="clearUnit.name" labelValue="${detail.clearUnit.name}"
										title="选择结算方" cssClass="form-control required" fieldLabels="结算方" fieldKeys="name" searchLabels="结算方" searchKeys="name" ></sys:gridselect>--%>
					</td>
					<td class="width-15 active"><label class="pull-right"><font color="red">*&nbsp;</font>计费合同：</label></td>
					<td class="width-35">
						<input type="text" value="${detail.feeAgreement.name}" class="form-control"  readonly="readonly"/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right"><font color="red">*&nbsp;</font>费用名称：</label></td>
					<td class="width-35">
						<input type="text" value="${detail.feeType.name}" class="form-control"  readonly="readonly"/>
					</td>
					<td class="width-15 active"><label class="pull-right"><font color="red">*&nbsp;</font>业务日期：</label></td>
					<td class="width-35">
						<div class='input-group form_datetime' id='busyDate'>
							<input type='text' id="dd" name="busyDate" class="form-control"  value="<fmt:formatDate value="${detail.busyDate}" pattern="yyyy-MM-dd HH:mm:ss"/>"/>
							<span class="input-group-addon">
			                        <span class="glyphicon glyphicon-calendar"></span>
			                    </span>
						</div>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">计费金额：</label></td>
					<td class="width-35">
						<input type="text" value="<fmt:formatNumber value="${detail.payMoney}" pattern="#.00"/>" class="form-control"  readonly="readonly"/>
					</td>
					<td class="width-15 active"><label class="pull-right">调整金额：</label></td>
					<td class="width-35">
						<input type="text" name="clearingMoney" value="<fmt:formatNumber value="${detail.clearingMoney}" pattern="#.00"/>" class="form-control"/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">状态：</label></td>
					<td class="width-35">
						<form:select path="status" id="status" class="form-control required">
							<form:option value="" label=""/>
							<form:options items="${fns:getDictList('detail_status')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
						</form:select>
						<%--<c:if test="${feeDetail.status eq null}">
							<input type="text" value="未结算" class="form-control"  readonly="readonly"/>
							<input type="hidden" name="status"value="0"/>
						</c:if>
						<c:if test="${feeDetail.status ne null}">
							<input type="text" readonly="readonly" class="form-control" value="${fns:getDictLabel(feeDetail.status, 'fee_detail_status', '')} "/>
							<input type="hidden" name="status"value="${feeDetail.status}"/>
						</c:if>--%>
					</td>
					<td class="width-15 active"><label class="pull-right">调整原因：</label></td>
					<td class="width-35" >
						<input type="text" name="updateReason" value="${detail.updateReason}" class="form-control"/>
					</td>
				</tr>
				</tbody>
			</table>

		<c:if test="${fns:hasPermission('fee:detail:edit') || isAdd}">
				<div class="col-lg-3"></div>
		        <div class="col-lg-6">
		             <div class="form-group text-center">
		                 <div>
		                     <button class="btn btn-primary btn-block btn-lg btn-parsley" data-loading-text="正在提交...">提 交</button>
		                 </div>
		             </div>
		        </div>
		</c:if>
		</form:form>
		</div>				
	</div>
	</div>
</div>
</div>
</body>
</html>